//
//  DKUnauthorizedMainHeadTableCell.m
//  DanKU
//
//  Created by 吴斌 on 2023/10/24.
//

#import "DKUnauthorizedMainHeadTableCell.h"
#import "DKUnauthorizedMainHeadView.h"
#import "DkUnathorizedMainCenterView.h"

static NSString * DK_UnauthorizedMainHeadCellId = @"DK_UnauthorizedMainHeadCellId";

@interface DKUnauthorizedMainHeadTableCell()
@property (nonatomic, strong)DKUnauthorizedMainHeadView * dk_UnauthorizedMainHeadView;
@property (nonatomic, strong)DkUnathorizedMainCenterView * dk_UnathorizedMainCenterView;
@end
@implementation DKUnauthorizedMainHeadTableCell
+ (instancetype)unauthorizedMainHeadCell:(UITableView *)tableView{
    DKUnauthorizedMainHeadTableCell * dk_UnauthorizedMainHeadCell = [tableView dequeueReusableCellWithIdentifier:DK_UnauthorizedMainHeadCellId];
    if (!dk_UnauthorizedMainHeadCell) {
        dk_UnauthorizedMainHeadCell = [[DKUnauthorizedMainHeadTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:DK_UnauthorizedMainHeadCellId];
    }
    dk_UnauthorizedMainHeadCell.backgroundColor = [UIColor clearColor];
    dk_UnauthorizedMainHeadCell.selectionStyle = UITableViewCellSelectionStyleNone;
    dk_UnauthorizedMainHeadCell.accessoryType = UITableViewCellAccessoryNone;
    return dk_UnauthorizedMainHeadCell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    WeakSelf(self)
    self.dk_UnauthorizedMainHeadView = [[DKUnauthorizedMainHeadView alloc] init];
    [self.contentView addSubview:self.dk_UnauthorizedMainHeadView];
    [self.dk_UnauthorizedMainHeadView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(0)));
        make.right.equalTo(@(-DK_IsWidthScale(0)));
        make.top.equalTo(@(DK_IsWidthScale(23)+DK_SafeAreaTop));
        make.height.equalTo(@(DK_IsWidthScale(265)));
    }];
    self.dk_UnauthorizedMainHeadView.CheckUserInfoBlock = ^{
        if(weakSelf.CheckUserInfoBlock){
            weakSelf.CheckUserInfoBlock();
        }
    };
    self.dk_UnathorizedMainCenterView = [[DkUnathorizedMainCenterView alloc] init];
    [self.contentView addSubview:self.dk_UnathorizedMainCenterView];
    [self.dk_UnathorizedMainCenterView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(0)));
        make.right.equalTo(@(-DK_IsWidthScale(0)));
        make.top.equalTo(self.dk_UnauthorizedMainHeadView.mas_bottom).offset(-DK_IsWidthScale(20));
        make.height.equalTo(@(DK_IsWidthScale(110)));
    }];
    self.dk_UnathorizedMainCenterView.CheckUserInfoBlock = ^(NSString * _Nonnull value, BOOL isLeft) {
        if(weakSelf.CheckUserMainBlock){
            weakSelf.CheckUserMainBlock(value, isLeft);
        }
    };
}
-(void)setDk_OrderListMdl:(DKOrderListModel *)dk_OrderListMdl{
    _dk_OrderListMdl = dk_OrderListMdl;
    self.dk_UnathorizedMainCenterView.dk_OrderListMdl = dk_OrderListMdl;
}
@end
